package com.chyblog.demo.clients;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;

/**
 * 使用自己的服务做远程服务名
 */
@FeignClient("${spring.application.name}")
interface MessageClient {

    @GetMapping(value = "/message")
    String getMessage();
}

@Component
public class FeignExample {

    @Autowired
    private MessageClient bookmarkClient;

    public String service() {
        return bookmarkClient.getMessage();
    }
}
